﻿using ReflectionStudio.Core.Events;
using System;
using System.ComponentModel;
using System.Data;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using WPFExcelReport.Helpers;
using System.Collections;
using System.Collections.Generic;
namespace WPFExcelReport
{
    public partial class TQEKP
    {
        public TQEKP()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VICC_QUERYTB();
            this.DataContext = MV;
            InitializeComponent();

        }
        public override void Window_Loaded(object sender, RoutedEventArgs e)
        {
            base.Window_Loaded(sender, e);
        }
        public override void Query_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key != System.Windows.Input.Key.Return || e.Key != System.Windows.Input.Key.Enter)
                return;
            this.Focus();
            if (TMV.DTSTART == "")
            {
                MV.DTSTART = "20000000";
            }
            if (TMV.DTEND == "")
            {
                TMV.DTEND = "99999999";
            }
            if (TMV.DTSTART1 == "")
            {
                TMV.DTSTART1 = "20000000";
            }
            if (TMV.DTEND1 == "")
            {
                TMV.DTEND1 = "99999999";
            }
            INFO = " AND EKPAUFKRS LIKE '%" + TMV.KRS.Trim() + "%'"
                  + " AND EKPAUFLFD LIKE '%" + TMV.LFD.Trim() + "%'"
                  + " AND EKPAUFPOS LIKE '%" + TMV.POS.Trim() + "%'"
                  + " AND EKPLIEFNR LIKE '" + LIEFNR.Trim() + "%'"
                  + " AND EKPNEUD  >=" + TMV.DTSTART + ""
                  + " AND EKPNEUD  <=" + TMV.DTEND + ""
                  + " AND EKPLTERM >=" + TMV.DTSTART1 + ""
                  + " AND EKPLTERM <=" + TMV.DTEND1 + "";
            QTYP = "QEKP";
            base.Query_KeyUp(sender, e);
            Control sd =sender as Control;
            sd.Focus();
        }

        public override void OnQueryChg(bool value)
        {
            if (!value)
                return;
            Query_KeyUp(null, null);
            base.OnQueryChg(value);
        }
    }
}
